﻿<Window x:Class="Veralkohol.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:Veralkohol"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:gif="http://wpfanimatedgif.codeplex.com"
        xmlns:mvvm="http://www.galasoft.ch/mvvmlight"
        Title="Véralkoholszint előrejelző alkalmazás © Horák Attila 2012" 
        Height="600" Width="800" MinHeight="480" MinWidth="700"
        DataContext="{Binding MainVM, Source={StaticResource VML}}"
        x:Name="mainwin">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary 
                  Source="Resources.xaml">
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
        
    </Window.Resources>

    <Grid>
        <Grid.Background>
            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="Black" Offset="0" />
                        <GradientStop Color="Black" Offset="0.9" />
                        <GradientStop Color="DarkGray" Offset="1" />
                    </GradientStopCollection>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="80" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>

        <my:AlcoholPlot Points="{Binding Points}"  x:Name="theDiagram"
                        YFrom="{Binding YFrom, Mode=TwoWay}" YTo="{Binding YTo, Mode=TwoWay}" 
                        XFrom="{Binding XFrom, Mode=TwoWay}" XTo="{Binding XTo, Mode=TwoWay}"
                        ScreenLeft="{Binding ElementName=mainwin, Path=Left}"
                        ScreenTop="{Binding ElementName=mainwin, Path=Top}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="DiagramChanged">
                    <i:InvokeCommandAction Command="{Binding DiagramChangedCommand}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </my:AlcoholPlot>

        <!--Alsó adatbeviteli rész-->

        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <!--Testsúly adatok-->
            <TextBlock Text="Testsúly (kg):" Margin="2" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"/>
            <TextBox Grid.Row="1" Margin="2" Text="{Binding Weight, Mode=TwoWay}" FontFamily="Ubuntu" IsEnabled="{Binding NoPoint}"/>
            <!--<Button Content="Módosít" Grid.Row="2" Margin="2"/>-->
            <Grid Grid.Row="2" Visibility="{Binding NotRealtime, Converter={StaticResource B2VC}}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Image Source="Images/realtime.gif" Grid.Column="0"/>
                <TextBlock Foreground="Red" Text="Valós idejű rajzolás inaktív" 
                           FontFamily="Ubuntu" FontWeight="Bold"
                           Grid.Column="1" VerticalAlignment="Center"/>

            </Grid>
            <Grid Grid.Row="2" Visibility="{Binding Realtime, Converter={StaticResource B2VC}}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Image gif:ImageBehavior.AnimatedSource="Images/realtime.gif" Grid.Column="0"/>
                <TextBlock Foreground="Green" Text="Valós idejű rajzolás aktív" 
                           FontFamily="Ubuntu" FontWeight="Bold"
                           Grid.Column="1" VerticalAlignment="Center"/>
            </Grid>
            

            <!--Függőleges fekete vonal-->
            <Rectangle Grid.Column="1" Grid.RowSpan="3" Fill="Black" Margin="2"/>

            <!--Alkohol típusa, %-os alkoholtartalma és a bevitt mennyiség-->
            <TextBlock Text="Alkohol típusa és mennyisége:" Grid.Column="2" Margin="2"
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"/>
            <!--Mennyiségek és típus megadása-->
            <Grid Grid.Column="2" Grid.Row="1" Grid.RowSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <ComboBox Text="Válasszon!" Margin="2" ItemsSource="{StaticResource DrinkResource}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="10" />
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Image Source="{Binding ImageName}" >
                                    <ToolTipService.ToolTip>
                                        <Image Source="{Binding Bigname}" />
                                    </ToolTipService.ToolTip>
                                </Image>
                                <TextBlock Grid.Column="2" Text="{Binding DrinkName}" FontFamily="Ubuntu" FontWeight="Bold" />
                            </Grid>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <mvvm:EventToCommand Command="{Binding SelectionChanged}" PassEventArgsToCommand="True" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </ComboBox>
                <TextBox Grid.Column="1" Margin="2" Text="{Binding Percentage,Mode=TwoWay}"/>
                <TextBlock Grid.Column="2" Text="%" VerticalAlignment="Center" 
                           FontFamily="Ubuntu" Foreground="WhiteSmoke"/>

                <TextBox Grid.ColumnSpan="2" Grid.Row="1" Margin="2" Text="{Binding Quantity,Mode=TwoWay}"/>
                <TextBlock Grid.Column="2" Grid.Row="1" Text="dl" VerticalAlignment="Center"
                           FontFamily="Ubuntu" Foreground="WhiteSmoke"/>

            </Grid>


            <!--Függőleges fekete csík-->
            <Rectangle Grid.Column="3" Grid.RowSpan="3" Fill="Black" Margin="2"/>

            <!---->
            <TextBlock Text="Időpont:" Grid.Column="4" Margin="2"
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"/>
            <Grid Grid.Column="4" Grid.Row="1" Margin="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <!--<Grid Grid.Column="0" Margin="2"><Grid.ColumnDefinitions><ColumnDefinition Width="30" /><ColumnDefinition Width="*" /></Grid.ColumnDefinitions>
                <TextBox Text="{Binding ElementName=sb1, Path=Value}" /><Slider x:Name="sb1" Minimum="0" Maximum="24" Grid.Column="1" IsSnapToTickEnabled="True"/>  
                </Grid>-->

            <my:NumericUpDown Grid.Column="0" x:Name="nud0" Margin="5,0,2,0" MinValue="0" Value="{Binding Day,Mode=TwoWay}" IsEnabled="{Binding NotRealtime}"/>
            <TextBlock Text="." Grid.Column="1" VerticalAlignment="Bottom"/>
            <my:NumericUpDown Grid.Column="2" x:Name="nud1" Margin="2,0,2,0" MinValue="0" MaxValue="23" Value="{Binding Hours,Mode=TwoWay}" IsEnabled="{Binding NotRealtime}"/>
            <TextBlock Text=":" Grid.Column="3" />
            <my:NumericUpDown x:Name="nud2" Grid.Column="4" Margin="2,0,5,0" MinValue="0" MaxValue="59" Value="{Binding Minutes, Mode=TwoWay}" IsEnabled="{Binding NotRealtime}"/>

            <!--<Grid Grid.Column="1" Margin="2"><Grid.ColumnDefinitions><ColumnDefinition Width="30" /><ColumnDefinition Width="*" /></Grid.ColumnDefinitions>
                <TextBox Text="{Binding ElementName=sb2, Path=Value}" /><Slider x:Name="sb2" Minimum="0" Maximum="59" Grid.Column="1" IsSnapToTickEnabled="True"/>  
                </Grid>-->
        </Grid>
        <Button Content="Valós idejű" Grid.Column="4" Grid.Row="2" Margin="2" Command="{Binding Realt}"/>

        <!---->
            <Rectangle Grid.Column="5" Grid.RowSpan="3" Fill="Black" Margin="2"/>
            <!---->

        <Button Grid.Column="6"   Content="Hozzáadás" Margin="20,2,20,0" Command="{Binding Add}"/>
        <!--Ez a hozzáadás alatti 3 gomb-->
        <Grid Grid.Column="6" Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Button Content="Új" Margin="20,0,2,0" Command="{Binding New}"/>
            <Button Content="Megnyitás" Margin="2,0,2,0" Grid.Column="1" Command="{Binding Load}">
                <!--<ToolTipService.ToolTip>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Button>
                            <Image Source="Images/remote.jpg" />
                        </Button>
                        <Button Grid.Column="2">
                            <Image Source="Images/local.jpg" />
                        </Button>
                    </Grid>
                </ToolTipService.ToolTip>-->
                
            </Button>
            <Button Content="Mentés" Margin="2,0,20,0" Grid.Column="2" Command="{Binding Save}"/>
        </Grid>
    </Grid>

    <!---->
        
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
                <ColumnDefinition Width="40" />
            </Grid.ColumnDefinitions>
            
            <TextBlock Grid.Column="0" Text="0.03‰" VerticalAlignment="Center" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="0.0‰-0.03‰ : Normál szint, nem fogyasztott alkoholt"/>
            <Rectangle Fill="WhiteSmoke" Grid.Column="1" Margin="0,15,10,15" ToolTipService.ToolTip="0.0‰-0.03‰ : Normál szint, nem fogyasztott alkoholt"/>
            <TextBlock Grid.Column="2" Text="0.5‰" VerticalAlignment="Center" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="0.03‰-0.5‰ : Eufórikus állapot, összehangolatlan mozgások"/>
            <Rectangle Fill="LightGreen" Grid.Column="3" Margin="0,15,10,15" ToolTipService.ToolTip="0.03‰-0.5‰ : Eufórikus állapot, összehangolatlan mozgások"/>
            <TextBlock Grid.Column="4" Text="1.5‰" VerticalAlignment="Center" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="0.5‰-1.5‰ : Ittas állapot, túlzott beszéd, hosszú szövegelések"/>
            <Rectangle Fill="Yellow" Grid.Column="5" Margin="0,15,10,15" ToolTipService.ToolTip="0.5‰-1.5‰ : Ittas állapot, túlzott beszéd, hosszú szövegelések"/>
            <TextBlock Grid.Column="6" Text="2.5‰" VerticalAlignment="Center" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="1.5‰-2.5‰ : Részegség, gyors hangulatváltás, agresszió, esetleg hányás"/>
            <Rectangle Fill="Orange" Grid.Column="7" Margin="0,15,10,15" ToolTipService.ToolTip="1.5‰-2.5‰ : Részegség, gyors hangulatváltás, agresszió, esetleg hányás"/>
            <TextBlock Grid.Column="8" Text="3.5‰" VerticalAlignment="Center" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="2.5‰-3.5‰ : Aluszékonység, mindennemű tevékenységre alklamatlan"/>
            <Rectangle Fill="Red" Grid.Column="9" Margin="0,15,10,15" ToolTipService.ToolTip="2.5‰-3.5‰ : Aluszékonység, mindennemű tevékenységre alklamatlan"/>
            <TextBlock Grid.Column="10" Text="4.5‰" VerticalAlignment="Center"
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="3.5‰-4.5‰ : Kóma, az alkoholtartalom egészségre káros, szakember beavatkozása szükséges"/>
            <Rectangle Fill="DarkRed" Grid.Column="11" Margin="0,15,10,15" ToolTipService.ToolTip="3.5‰-4.5‰ : Kóma, az alkoholtartalom egészségre káros, szakember beavatkozása szükséges"/>
            <TextBlock Grid.Column="12" Text="5‰" VerticalAlignment="Center" 
                       FontFamily="Ubuntu" FontWeight="Bold" Foreground="WhiteSmoke"
                       ToolTipService.ToolTip="4.5‰-5‰ vagy fölötte : Halálos, a bevitt mennyiség halálos"/>
            <Rectangle Fill="Black" Grid.Column="13" Margin="0,15,10,15" ToolTipService.ToolTip="4.5‰-5‰ vagy fölötte : Halálos, a bevitt mennyiség halálos"/>
            
            <Image Source="Images/1CAROK.png" Width="30" Height="30" Grid.Column="15" Opacity="{Binding Opac[0]}" ToolTipService.ToolTip="Vezetés megengedett"/>
            <Image Source="Images/2CARNOK.png" Width="30" Height="30" Grid.Column="16" Opacity="{Binding Opac[1]}" ToolTipService.ToolTip="Tilos volán mögé ülni!"/>
            <Image Source="Images/3SPEAK.png" Width="30" Height="30" Grid.Column="17" Opacity="{Binding Opac[2]}" ToolTipService.ToolTip="Túlzott beszéd"/>
            <Image Source="Images/4ANGRY.png" Width="30" Height="30" Grid.Column="18" Opacity="{Binding Opac[3]}" ToolTipService.ToolTip="Hirtelen düh veszélye, legyen óvatos!"/>
            <Image Source="Images/5ILL.png" Width="30" Height="30" Grid.Column="19" Opacity="{Binding Opac[4]}" ToolTipService.ToolTip="Hányás előfordulhat"/>
            <Image Source="Images/6DRUNK.png" Width="30" Height="30" Grid.Column="20" Opacity="{Binding Opac[5]}" ToolTipService.ToolTip="Aluszékonyság, alkalmatlan bármire"/>
            <Image Source="Images/7HOSPITAL.png" Width="30" Height="30" Grid.Column="21" Opacity="{Binding Opac[6]}" ToolTipService.ToolTip="Szakorovosi ellátás ajánlott!"/>
            <Image Source="Images/8DEATH.png" Width="30" Height="30" Grid.Column="22" Opacity="{Binding Opac[7]}" ToolTipService.ToolTip="Halálos adag!!!"/>
            
        </Grid>
        
    </Grid>
</Window>
